package com.sky.mapper.admin;

import com.sky.annotation.AutoFill;
import com.sky.enumeration.OperationType;
import com.sky.pojo.Category;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface CategoryMapper {
   /**添加新增菜品分来和新增套餐分类*/
    @AutoFill(value = OperationType.INSERT)
    void insertCategory(Category category);


    /**进行菜品套餐分类页面分页查询*/
    List<Category> selectCategory(String name,Integer type);



    /**根据id删除行数据*/
    void deleteCategory(Long id);


    /**修改行数据*/
    @AutoFill(value = OperationType.UPDATE)
    void updateCategory(Category category);



    /**启用或禁用分类行数据status*/
    void updateCategoryStatus(Integer id,Integer status);


    /**查询菜品分类名称给进行菜品管理添加*/
    @Select("select * from category where type=#{type} and status=1;")
    List<Category> selectName(Integer type);


   /**增删改后放回id查询菜品类型1或0进行删除redis缓存*/
   @Select("select type from category where id=#{id}")
   Integer selectType(long id);


}
